// FrogRenameTruncateDialog.h : Declaration of the CFrogRenameTruncateDialog

#pragma once

#include "resource.h"       // main symbols
#include <atlhost.h>
#include "FrogProgressReportDialog.h"


// CFrogRenameTruncateDialog

class CFrogRenameTruncateDialog: public CFrogProgressReportDialog<CFrogRenameTruncateDialog>,
	public CWinDataExchange<CFrogRenameTruncateDialog>
{
public:

	enum { IDD = IDD_DIALOG_RENAME_TRUNC };

	CFrogRenameTruncateDialog(HICON hIcon);

	BEGIN_MSG_MAP(CFrogRenameTruncateDialog)
		MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
		COMMAND_HANDLER(IDOK, BN_CLICKED, OnClickedOK)						
		COMMAND_HANDLER(IDC_CHECK_INCLUDE_EXT, BN_CLICKED, OnEnChangeConfig)
		COMMAND_HANDLER(IDC_RADIO_BEGINING, BN_CLICKED, OnEnChangeConfig)
		COMMAND_HANDLER(IDC_RADIO_END, BN_CLICKED, OnEnChangeConfig)				
		COMMAND_HANDLER(IDC_EDIT_NUM_CHARS, EN_CHANGE, OnEnChangeConfig)
		// FrogBaseDialog Inherited
		CHAIN_MSG_MAP(CFrogProgressReportDialog)
	END_MSG_MAP()

	BEGIN_DDX_MAP(CFrogRenameTruncateDialog)
		DDX_INT(IDC_EDIT_NUM_CHARS, m_NumCharsToTruncate)
		DDX_CHECK(IDC_CHECK_INCLUDE_EXT, m_IncludeFileExtension)
		DDX_RADIO(IDC_RADIO_BEGINING, m_TruncFromBeginingInt)
	END_DDX_MAP()
	// Handler prototypes:
	//  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	//  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	//  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);

	LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnClickedOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	
	LRESULT OnEnChangeConfig(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	
	virtual void ExecuteCommand();

	int m_TruncFromBeginingInt;
	int m_NumCharsToTruncate;
	bool m_TruncFromBegining;
	bool m_IncludeFileExtension;
private:

	bool m_IsInitDialog;

	void SetPostPrePreview(wstring originalName = L"filename.ext");
};


